home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
os2
/
adaptor.zip
/
ADAPT.ZIP
/
adaptor
/
examples
/
databnch
/
local.fcm
< prev
next >
Wrap
Text File
|
1993-05-27
|
28KB
|
923 lines
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C C
C Benchmark Program for data parallel operations C
C C
C Local Operations (single, double, integer) C
C C
C ADAPTOR Version 1.0 C
C C
C Author: Dr. Thomas Brandes, GMD, I1.HR C
C Date: December, 1992 C
C C
C measures: C
C C
C - movements, initializations C
C - binary operations C
C - axpy, complex operations C
C - intrinsic functions C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
program benchmark
integer nproc, size, npts, nops, op, nflop, initsize
integer i, j, k, number, step
parameter (initsize = 16)
parameter (npts = 13)
real time (npts), tover
real usec, mflops, mops
cmf$ layout time(:serial)
write (6,*) 'Input number of processors : '
read (5,*) nproc
call overhead (tover)
write (6,*) '==============================================='
write (6,*) '| |'
write (6,*) '| ADAPTOR BENCHMARK PROGRAM by Thomas Brandes |'
write (6,*) '| |'
write (6,*) '| Simple Operations |'
write (6,*) '| |'
write (6,*) '==============================================='
write (6,*) ' '
write (6,*) 'BENCHMARK FOR P = ', nproc
write (6,*) '==============================='
write (6,*) ' '
c
c testing moving operations
c
step = 1
write (6,*) ' '
write (6,*) 'ADAPTOR: moving operations'
write (6,*) '=============================='
write (6,*) ' '
write (6,*) ' z (1:size*nproc) = ... '
write (6,*) ' '
do k = 1, 3
do op = 1, 5
size = initsize
do i = 1, npts
if (k .eq. 1) call smoves (op, size, nproc, time(i))
if (k .eq. 2) call dmoves (op, size, nproc, time(i))
if (k .eq. 3) call imoves (op, size, nproc, time(i))
time(i) = time(i) - tover
size = size * 2
end do
call info (step, op, k, nflop)
call output (initsize,time, npts, nflop, nproc)
end do ! loop for op
end do ! loop for k
c
c testing binary operations
c
step = 2
write (6,*) ' '
write (6,*) 'ADAPTOR: binary operations'
write (6,*) '============================='
write (6,*) ' '
write (6,*) ' z (1:size,1:nproc) = x(:,:) op y(:,:) '
write (6,*) ' '
do k = 1, 3
do op = 1, 6
size = initsize
do i = 1, npts
if (k .eq. 1) call sbinops (op, size, nproc, time(i))
if (k .eq. 2) call dbinops (op, size, nproc, time(i))
if (k .eq. 3) call ibinops (op, size, nproc, time(i))
time(i) = time(i) - tover
c write (6,*) 'size = ', size, ' time = ', time(i)
size = size * 2
end do
call info (step, op, k, nflop)
call output (initsize, time, npts, nflop, nproc)
end do ! loop for op
end do ! loop for k
c
c testing mixed operations (single)
c
step = 3
write (6,*) ' '
write (6,*) 'ADAPTOR: mixed operations'
write (6,*) '=========================='
write (6,*) ' '
do k = 1, 3
do op = 1, 3
size = initsize
do i = 1, npts
if (k .eq. 1)
& call scombops (op, size, nproc, time(i), nflop)
if (k .eq. 2)
& call dcombops (op, size, nproc, time(i), nflop)
if (k .eq. 3)
& call icombops (op, size, nproc, time(i), nflop)
time(i) = time(i) - tover
c write (6,*) 'size = ', size, ' time = ', time(i)
size = size * 2
end do
call info (step, op, k, nflop)
call output (initsize,time, npts, nflop, nproc)
end do
end do
c
c testing intrinsic functions
c
step = 4
write (6,*) ' '
write (6,*) 'ADAPTOR: intrinsic functions'
write (6,*) '==============================='
write (6,*) ' '
write (6,*) ' z (1:size,1:nproc) = f (x(:,:)) '
write (6,*) ' '
do k = 1, 2
do op = 1, 3
size = initsize
do i = 1, npts
if (k .eq. 1)
& call sintrinsics (op, size, nproc, time(i))
if (k .eq. 2)
& call dintrinsics (op, size, nproc, time(i))
time(i) = time(i) - tover
c write (6,*) 'size = ', size, ' time = ', time(i)
size = size * 2
end do
call info (step, op, k, nflop)
call output (initsize,time, npts, nflop, nproc)
end do ! loop for op
end do ! loop for k
write (6,*) 'Benchmark ready'
end
c
subroutine output (initsize,time, npts, nflop, nproc)
implicit none
integer initsize,npts, nflop, nproc
real time (npts)
cmf$ layout time (:serial)
integer i, size
real usec, mops, mflops
write (6,*) ' size usec MOps(1) MOps(n) MFlops(n)'
do i = 1, npts
size = initsize * 2**(i-1)
usec = time(i) * 1e6
mops = 1e-6*size/time(i)
mflops = mops * nflop
write (6, '(i5,f11.2,3f9.3)') size, usec, mops, mops*nproc,
& mflops*nproc
end do
write (6,*) ' '
end
subroutine info (step, op, kind, nflop)
c
c print info to step with operation op and type kind
c
c return number of flop for the operation
c
implicit none
integer step, op, kind, nflop
c
nflop = 1
c
if (step .eq. 1) then
if (op .eq. 1) write (6,*) 'z = 3 '
if (op .eq. 2) write (6,*) 'z(::s) = 3'
if (op .eq. 3) write (6,*) 'z = [1:n] '
if (op .eq. 4) write (6,*) 'z = x '
if (op .eq. 5) write (6,*) 'z = random()'
end if
if (step .eq. 2) then
if (op .eq. 1) write (6,*) 'z = x + y (1 Flop)'
if (op .eq. 2) write (6,*) 'z = x * c (1 Flop)'
if (op .eq. 3) write (6,*) 'z = x * y (1 Flop)'
if (op .eq. 4) write (6,*) 'z = x / y (4 Flops)'
if (op .eq. 5) write (6,*) 'where +/- (1 Flops)'
if (op .eq. 6) write (6,*) 'z(:5)= + (1 Flops)'
if (op .eq. 4) nflop = 4
end if
if (step .eq. 3) then
if (op .eq. 1) write(6,*) 'z = x + c * y (2 Flop)'
if (op .eq. 2) write(6,*) 'z=0, z+=c1*x, z+=c2*y (4 Flop)'
if (op .eq. 3) write(6,*) 'z=c1*x+c2*y, z=c1*z-c2*x (6 Flop)'
if (op .eq. 1) nflop = 2
if (op .eq. 2) nflop = 4
if (op .eq. 3) nflop = 6
end if
if (step .eq. 4) then
if (op .eq. 1) write (6,*) 'z = sin(x) (8 Flops)'
if (op .eq. 2) write (6,*) 'z = exp(x) (8 Flops)'
if (op .eq. 3) write (6,*) 'z = sqrt(x) (4 Flops)'
if (op .eq. 1) nflop = 8
if (op .eq. 2) nflop = 8
if (op .eq. 3) nflop = 4
end if
if (kind .eq. 1) write (6,*) 'single precision'
if (kind .eq. 2) write (6,*) 'double precision'
if (kind .eq. 3) write (6,*) 'integer'
end
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C measure movements C
C C
C 1. Z = 3.0 C
C 2. Z = [1:n] C
C 3. Z = X C
C 4. Z = random C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
subroutine smoves (op, size, nproc, time)
integer op, size, nproc
real time, t0, t1
real x(size*nproc), z(size*nproc), val, check
integer i, nloop, s
x = 1.5
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = 3.0
end do
call walltime (t1)
check = z(1)
else if (op .eq. 2) then
call stride (s)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z(::s) = 3.0
end do
call walltime (t1)
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = [1:size*nproc]
end do
call walltime (t1)
check = z(1)
else if (op .eq. 4) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = x
end do
call walltime (t1)
check = z(1)
else if (op .eq. 5) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
call cmf_random (z)
end do
call walltime (t1)
check = z(1)
else
write (6,*) 'operation error in moves'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'moves = ', op, ' Check = ', check
end
subroutine dmoves (op, size, nproc, time)
integer op, size, nproc
real time, t0, t1
double precision x(size*nproc), z(size*nproc), val, check
integer i, nloop, s
x = 1.5
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = 3.0
end do
call walltime (t1)
check = z(1)
else if (op .eq. 2) then
call stride (s)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z(::s) = 3.0
end do
call walltime (t1)
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = [1:size*nproc]
end do
call walltime (t1)
check = z(1)
else if (op .eq. 4) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = x
end do
call walltime (t1)
check = z(1)
else if (op .eq. 5) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
call cmf_random (z)
end do
call walltime (t1)
check = z(1)
else
write (6,*) 'operation error in moves'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'moves = ', op, ' Check = ', check
end
subroutine imoves (op, size, nproc, time)
integer op, size, nproc
real time, t0, t1
integer x(size*nproc), z(size*nproc), val, check
integer i, nloop, s
x = 13
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = 3
end do
call walltime (t1)
check = z(1)
else if (op .eq. 2) then
call stride (s)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z(::s) = 3
end do
call walltime (t1)
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = [1:size*nproc]
end do
call walltime (t1)
check = z(1)
else if (op .eq. 4) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
z = x
end do
call walltime (t1)
check = z(1)
else if (op .eq. 5) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, x, z)
call cmf_random (z,100)
end do
call walltime (t1)
check = z(1)
else
write (6,*) 'operation error in moves'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'moves = ', op, ' Check = ', check
end
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C measure binary operations C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
subroutine sbinops (op, size, nproc, time)
integer op, size, nproc
real time, t0, t1
real x(size*nproc), y(size*nproc), z(size*nproc), val, check
integer i, nloop, s
x = 1.5
y = 3.0
val = 2.1
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x + y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 2) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x * val
end do
call walltime (t1)
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x * y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 4) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x / y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 5) then
call cmf_random (x)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
where (x .gt. 0.5)
z = y - x
elsewhere
z = y + x
endwhere
end do
call walltime (t1)
check = z(1)
else if (op .eq. 6) then
call stride (s)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z(::s) = x(::s) + y(::s)
end do
call walltime (t1)
check = z(1)
else
write (6,*) 'operation error in binops'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'Binop = ', op, ' Check = ', check
end
subroutine dbinops (op, size, nproc, time)
integer op, size, nproc
real time, t0, t1
double precision x(size*nproc), y(size*nproc)
double precision z(size*nproc), val, check
integer i, nloop, s
x = 1.5
y = 3.0
val = 2.1
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x + y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 2) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x * val
end do
call walltime (t1)
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x * y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 4) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x / y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 5) then
call cmf_random (x)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
where (x .gt. 0.5)
z = y - x
elsewhere
z = y + x
endwhere
end do
call walltime (t1)
check = z(1)
else if (op .eq. 6) then
call stride (s)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z(::s) = x(::s) + y(::s)
end do
call walltime (t1)
check = z(1)
else
write (6,*) 'operation error in binops'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'Binop = ', op, ' Check = ', check
end
subroutine ibinops (op, size, nproc, time)
integer op, size, nproc
real time, t0, t1
integer x(size*nproc), y(size*nproc)
integer z(size*nproc), val, check
integer i, nloop, s
x = 7
y = 3
val = 2
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x + y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 2) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x * val
end do
call walltime (t1)
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x * y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 4) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x / y
end do
call walltime (t1)
check = z(1)
else if (op .eq. 5) then
call cmf_random (x,10)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
where (x .gt. 5)
z = y - x
elsewhere
z = y + x
endwhere
end do
call walltime (t1)
check = z(1)
else if (op .eq. 6) then
call stride (s)
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z(::s) = x(::s) + y(::s)
end do
call walltime (t1)
check = z(1)
else
write (6,*) 'operation error in binops'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'Binop = ', op, ' Check = ', check
end
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C measure combined operations C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
subroutine scombops (op, size, nproc, time, nflop)
integer op, size, nproc, nflop
real time, t0, t1
real x(size*nproc), y(size*nproc), z(size*nproc), check
real val, val1, val2
integer i, nloop
x = 1.5
y = 3.0
val = 2.1
val1 = 1.8
val2 = 3.7
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x + val * y
end do
call walltime (t1)
nflop = 2
check = z(1)
else if (op .eq. 2) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = 0
z = z + val * x
z = z + val1 * y
end do
call walltime (t1)
nflop = 4
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = val * x + val1 * y
z = val * z - val1 * x
end do
call walltime (t1)
nflop = 6
check = z(1)
else
write (6,*) 'operation error in combops'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'Combop = ', op, ' Check = ', check
end
subroutine dcombops (op, size, nproc, time, nflop)
integer op, size, nproc, nflop
real time, t0, t1
double precision x(size*nproc), y(size*nproc), z(size*nproc)
double precision check, val, val1, val2
integer i, nloop
x = 1.5
y = 3.0
val = 2.1
val1 = 1.8
val2 = 3.7
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x + val * y
end do
call walltime (t1)
nflop = 2
check = z(1)
else if (op .eq. 2) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = 0.0
z = z + val * x
z = z + val1 * y
end do
call walltime (t1)
nflop = 4
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = val * x + val1 * y
z = val * z - val1 * x
end do
call walltime (t1)
nflop = 6
check = z(1)
else
write (6,*) 'operation error in combops'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'Combop = ', op, ' Check = ', check
end
subroutine icombops (op, size, nproc, time, nflop)
integer op, size, nproc, nflop
real time, t0, t1
integer x(size*nproc), y(size*nproc), z(size*nproc)
integer check, val, val1, val2
integer i, nloop
x = 15
y = 30
val = 21
val1 = 18
val2 = 37
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = x + val * y
end do
call walltime (t1)
nflop = 2
check = z(1)
else if (op .eq. 2) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = 0
z = z + val * x
z = z + val1 * y
end do
call walltime (t1)
nflop = 4
check = z(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, z)
z = val * x + val1 * y
z = val * z - val1 * x
end do
call walltime (t1)
nflop = 6
check = z(1)
else
write (6,*) 'operation error in combops'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'Combop = ', op, ' Check = ', check
end
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C measure intrinsics C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
subroutine sintrinsics (op, size, nproc, time)
integer op, size, nproc
real time, t0, t1
real x(size*nproc), y(size*nproc), check
integer i, nloop
x = 3.0
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, x)
y = sin(x)
end do
call walltime (t1)
check = y(1)
else if (op .eq. 2) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, x)
y = exp(x)
end do
call walltime (t1)
check = y(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, x)
y = sqrt (x)
end do
call walltime (t1)
check = y(1)
else
write (6,*) 'operation error in intrinsics'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'Intrinsic = ', op, ' Check = ', check
end
subroutine dintrinsics (op, size, nproc, time)
integer op, size, nproc
real time, t0, t1
double precision x(size*nproc), y(size*nproc), check
integer i, nloop
x = 3.0
nloop = 1
10 if (op .eq. 1) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, x)
y = sin(x)
end do
call walltime (t1)
check = y(1)
else if (op .eq. 2) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, x)
y = exp(x)
end do
call walltime (t1)
check = y(1)
else if (op .eq. 3) then
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy1 (i, nloop, x, y, x)
y = sqrt (x)
end do
call walltime (t1)
check = y(1)
else
write (6,*) 'operation error in intrinsics'
end if
time = t1 - t0
call nloopupdate (time, nloop)
if (nloop .gt. 0) goto 10
c write (6,*) 'Intrinsic = ', op, ' Check = ', check
end
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C C
C loop handling C
C C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
subroutine nloopupdate (time, n)
real time, runtime
parameter (runtime = 1.0)
integer n
if (time .lt. 0.1) then
n = n * 10
else if (time .lt. (runtime / 2.0)) then
n = n * (runtime / time)
else
time = time / n
n = 0
end if
end
c the next subroutine measures the loop overhead
subroutine overhead (tover)
real tover, t0, t1, x
integer i, nloop
nloop = 100000
call walltime (t0)
do i = 1, nloop
if (i .gt. nloop) call dummy (x)
end do
call walltime (t1)
tover = (t1 - t0) / nloop
write (6,*) 'Loop overhead ', tover, ' sec'
end
subroutine dummy (x)
real x
print *, 'dummy error, should never be really called'
end
subroutine dummy1 (i, n, x, y, z)
integer i, n
real x(10), y(10), z(10)
print *, 'error in dummy1, should never be really called'
print *, 'i = ', i, ' n = ', n
stop
end
subroutine stride (s)
integer s
s = 5
end